<h1>Sale</h1>
<? if ($t['noHalls']): ?>
<p>Aktualnie nie ma żadnych sal.</p>
<p><a href="<?= $ro->gen('hall.add') ?>">Dodaj nową salę</a>.</p>
<? else: ?>
<table>
	<thead>
		<tr>
			<th>ID</th>
			<th>Nazwa</th>
			<th>Adres</th>
			<th>Pojemność</th>
			<th>Akcje</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td colspan="99">
				<? if ($user->hasCredential('halls.add')): ?><a href="<?= $ro->gen('hall.add') ?>">Dodaj nową salę</a><? endif ?>
				<div class="pager">
					<?= data_pager($t['pager'], 'hall.browse', 'page', array('perPage' => $t['perPage'])) ?>
				</div>
			</td>
		</tr>
	</tfoot>
	<tbody>
		<? foreach ($t['halls'] as $hall): ?>
		<tr>
			<td><?= $hall['id'] ?></td>
			<td><?= e($hall['name']) ?></td>
			<td><?= e($hall['address']) ?></td>
			<td><?= (int)$hall['capacity'] ?></td>
			<td class="actions">
				<? if ($user->hasCredential('halls.read')): ?><a href="<?= $ro->gen('hall.read', array('id' => $hall['id'])) ?>">Pokaż</a><? endif ?>
				<? if ($user->hasCredential('halls.edit')): ?><a href="<?= $ro->gen('hall.edit', array('id' => $hall['id'])) ?>">Edytuj</a><? endif ?>
				<? if ($user->hasCredential('halls.delete')): ?><a href="<?= $ro->gen('hall.delete', array('id' => $hall['id'])) ?>">Usuń</a><? endif ?>
				<? if ($user->hasCredential('reservations.browse')): ?><a href="<?= $ro->gen('reservation.browse', array('hall' => $hall['id'])) ?>">Rezerwacje</a><? endif ?>
				<? if ($user->hasCredential('reservations.request')): ?><a href="<?= $ro->gen('reservation.request', array('hall' => $hall['id'])) ?>">Rezerwuj</a><? endif ?>
			</td>
		</tr>
		<? endforeach ?>
	</tbody>
</table>
<? endif ?>